#ifndef ENNEMI_H
#define ENNEMI_H

#include <QGraphicsScene>
#include <QGraphicsItem>
#include <QGraphicsObject>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include <QWidget>
#include <QPixmap>
#include <QColor>
#include <QList>
#include "case.h"
#include "jeu.h"
#include <QDebug>
#include <cmath>
#include <QTime>

enum tModeDeplacement { rampant, volant };

class Jeu;

class Ennemi: public QGraphicsItem
{
protected:
    Jeu* jeu;
    qreal taille;
    tModeDeplacement modeDeplacement;
    qreal hp;
    int spritecompteur;
public:
    Ennemi(Jeu* jeu);
    virtual ~Ennemi() {};
    virtual void touche(float attaque);
    qreal getHP() { return hp; }
    virtual qreal vitalite() = 0;
    virtual qreal resistance() = 0;
    virtual qreal vitesse() = 0;
    void avancer(int, int);
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    QRectF boundingRect() const;
    virtual QList<QPixmap>& getSprites() = 0;
public slots:
    void advance(int phase);
signals:
    void arrivee();

};
class Fourmi : public Ennemi
{
private:
    static QList<QPixmap> sprites;
    int compteur;
    bool touchee;
public:
    Fourmi(Jeu* jeu, float taille);
    ~Fourmi() {}
    void touche(float attaque);
    qreal vitalite() { return 5*pow(taille,2); }
    qreal resistance() { return pow(taille,2); }
    qreal vitesse() {
        qreal v = 2+pow(taille,2);
        if (touchee) v*= 1.5;
        return v;
    }

    QList<QPixmap>& getSprites() { return sprites; }
public slots:
    void advance(int phase);
};
class Cafard : public Ennemi
{
private:
    static QList<QPixmap> sprites;
public:
    Cafard(Jeu* jeu, float taille);
    ~Cafard();
    qreal vitalite() { return 10*pow(taille,2); }
    qreal resistance() { return 5*pow(taille,2); }
    qreal vitesse() { return 2; }
    QList<QPixmap>& getSprites() { return sprites; }
};
#endif // ENNEMI_H
